import {reqCategoryList,reqGetBannerList,reqGetFloorList} from '@/api/index'
    const state = {
        categoryList:[],
        bannerList:[],
        floorList:[]
    }
    const actions ={
        // 发送axios 请求  并通过 async 和 await  直接获取到值
        async getCategory({commit}){
            let result = await reqCategoryList();
            if(result.code == 200){
                commit("GETCATEGORY",result.data);
            }
        },
        async getBannerList({commit}){
            let result = await reqGetBannerList();
            if(result.code == 200){
                commit('GETBANNERLIST',result.data)
            }
        },
       async getFloorList({commit}){
           let result = await reqGetFloorList();
           if(result.code == 200){
                commit('GETFLOORLIST',result.data)
           }
       }
    }
    const mutations = {
        GETCATEGORY(state,value){
            state.categoryList = value
        },
        GETBANNERLIST(state,bannerlist){
            state.bannerList = bannerlist
        },
        GETFLOORLIST(state,floorlist){
            state.floorList = floorlist
        }
    }
    const getters = {} 
export default {
    state,
    actions,
    mutations,
    getters
}
